home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Daemon
/
BackdropColor.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-10-11
|
3KB
|
94 lines
#define DEBUG
#include <debug.h>
#include "backfill.h"
#include "mp.h"
#include <proto/cybergraphics.h>
#include <graphics/gfx.h>
extern BOOL V39;
static void __saveds __asm RGB_BackfillFunc(register __a0 struct RGB_BackfillHook *BF,register __a2 struct RastPort *RP,register __a1 struct BackFillMsg *BFM);
static void __saveds __asm RGB_CyberGfxBackfillFunc(register __a0 struct RGB_BackfillHook *BF,register __a2 struct RastPort *RP,register __a1 struct BackFillMsg *BFM);
struct RGB_BackfillHook
{
struct Hook rgb_Hook;
struct Screen *rgb_Screen;
BOOL rgb_UseCyberGfx;
LONG rgb_Pen;
};
struct Hook *RGB_AllocBackfillHook(struct Screen *Scr, struct DefaultNode *DN)
{
struct RGB_BackfillHook *b;
if(V39)
{
if(b=AllocVec(sizeof(*b),MEMF_CLEAR|MEMF_PUBLIC))
{
if(GetBitMapAttr(Scr->RastPort.BitMap,BMA_DEPTH) >8 )
{
if(CyberGfxBase)
{
/* Since it is >8 bits */
b->rgb_UseCyberGfx=IsCyberModeID( GetVPModeID(&Scr->ViewPort) );
}
}
if(b->rgb_UseCyberGfx)
{
b->rgb_Pen=(DN->BackdropRGB.Red & 0xff000000)>>8 |
(DN->BackdropRGB.Green & 0xff000000)>>16 |
(DN->BackdropRGB.Blue & 0xff000000)>>24;
b->rgb_Hook.h_Entry = (ULONG (*)())RGB_CyberGfxBackfillFunc;
return((struct Hook *)b);
}
else
{
if(-1!=(b->rgb_Pen=ObtainBestPen(Scr->ViewPort.ColorMap,DN->BackdropRGB.Red,DN->BackdropRGB.Green,DN->BackdropRGB.Blue,0)))
{
b->rgb_Screen=Scr;
b->rgb_Hook.h_Entry = (ULONG (*)())RGB_BackfillFunc;
return((struct Hook *)b);
}
}
FreeVec(b);
}
}
return(0);
}
void RGB_FreeBackfillHook(struct Hook *Hook)
{
struct RGB_BackfillHook *bf;
bf=(struct RGB_BackfillHook *)Hook;
if(!bf->rgb_UseCyberGfx)
ReleasePen(bf->rgb_Screen->ViewPort.ColorMap,bf->rgb_Pen);
FreeVec(bf);
}
static void __saveds __asm RGB_BackfillFunc(register __a0 struct RGB_BackfillHook *BF,register __a2 struct RastPort *RP,register __a1 struct BackFillMsg *BFM)
{
struct RastPort rp;
rp = *RP; // copy the rastport
rp.Layer = NULL; // eliminate bogus clipping from our copy
SetAPen(&rp,BF->rgb_Pen);
RectFill(&rp,BFM->Bounds.MinX,BFM->Bounds.MinY,BFM->Bounds.MaxX,BFM->Bounds.MaxY);
}
static void __saveds __asm RGB_CyberGfxBackfillFunc(register __a0 struct RGB_BackfillHook *BF,register __a2 struct RastPort *RP,register __a1 struct BackFillMsg *BFM)
{
struct RastPort rp;
rp = *RP; // copy the rastport
rp.Layer = NULL; // eliminate bogus clipping from our copy
FillPixelArray(&rp,BFM->Bounds.MinX,BFM->Bounds.MinY,BFM->Bounds.MaxX-BFM->Bounds.MinX+1,BFM->Bounds.MaxY-BFM->Bounds.MinY+1,BF->rgb_Pen);
}